﻿using System.Composition;
using System.Globalization;
using System.Resources;
using System.Windows.Media;

namespace GaleSong
{
    [Export(typeof (IResource))]
    public class Resource : IResource
    {
        private readonly ResourceManager _imageResource = null;
        private readonly ResourceManager _stringResource = null;
        private CultureInfo _culture = new CultureInfo("zh-cn");

        public Resource()
        {
            _stringResource = new ResourceManager("GaleSong.Resources.StringResource", typeof (Resource).Assembly);
        }

        #region IResource Members

        public CultureInfo CurrentCulture
        {
            set { _culture = value; }
        }

        public string GetString(string name)
        {
            return _stringResource.GetString(name, _culture);
        }

        public ImageSource GetImage(string name)
        {
            return _imageResource.GetImageSource(name);
        }

        #endregion
    }
}